#include<stdio.h>
void bubblesort(int a[],int n){
	int temp;
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			if(a[i]<a[j]){
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;
			}
		}
	}
}
int findmostdynamically(int *ming,int *li,int n){
	int dp[n+1],licompared[n+1];
	for(int i=0;i<=n;i++){
		dp[i]=0;
		licompared[i]=1;
	}
	int findbigger;
	for(int i=1;i<=n;i++){
		findbigger=0;
		for(int j=1;j<=n;j++){
			if(*(ming+i-1)>*(li+j-1) && licompared[j]==1){
				findbigger=1;
				licompared[j]=0;
				break;
			}
		}
		if(findbigger==1) dp[i]=dp[i-1]+1;
		else dp[i]=dp[i-1];
	}
	return dp[n];
}
int main(){
	int n;
	scanf("%d",&n);
	int mingscore[n],liscore[n];
	for(int i=0;i<n;i++) scanf("%d",&mingscore[i]);
	for(int i=0;i<n;i++) scanf("%d",&liscore[i]);
	int *ming,*li;
	ming=mingscore;
	li=liscore;
	bubblesort(ming,n);
	bubblesort(li,n);
	printf("%d",findmostdynamically(ming,li,n));
	return 0;
}
